



*use "C:\Users\n716a235\Documents\Avdan Hoffman Onder ISA Credit Claims\CreditClaimingData from Excel with press freedom_working.dta"

*keep   gname gid gid_cow year ccode end duration foundedafter claimed_log claimed_per claimed compclaims claimdummy polity2 polity_sq log_pop log_gdp_percap ucdp_internal lack_stterrcontrol claimdummy num_base mul_bases left nat rel right size peak_size shr_trans total_atks total_casualties endstr terrctrl lead_hierarch diversity state_sponsor nonterr_deaths total_deaths attacks_civi_tot  ucdp_internal individual unknownlog logattacksciv log_competitor multi_base_aps log_gdp_percap  total_attacksgtd_log

 use"C:\Users\n716a235\Documents\Avdan Hoffman Onder ISA Credit Claims\Credit Claims Replication.dta", clear


stset, clear

stset duration, failure(end)

*Replicates Table 3 of the appendix
 
stcox claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)

  outreg2 using DraftTable2v2, replace word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (claimed_per claimed_log claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog)

 
stcox claimed_log peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)

  outreg2 using DraftTable2v2, append word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per claimed_log claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog)
 
stcox claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)

  outreg2 using DraftTable2v2, append word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (  claimed_per claimed_log claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog)



 lab var peak_size "Group Peak Size"
 lab var left "Leftist Ideology"
 lab var right "Right-wing Ideology"
 lab var nat "Nationalist Ideology"
 lab var logattacksciv "Attacks on Civilians (logged)"
 lab var diversity "Attack Diversity"
 lab var shr_trans "Share Transnational"
 lab var lack_stterrcontrol "Lack Territorial Control"
 
 
 lab var log_pop "Base Country Population (logged)"
 lab var polity2 "Base Country Polity IV"
 lab var polity_sq "Polity score squared"
 lab var log_gdp_percap "GDP pc (logged)"
 lab var ucdp_internal "UCDP internal conflict in Base"

 lab var multi_base_aps "Multiple Bases"
 lab var shr_trans "Share Transnational"
 lab var diversity "Attack Diversity"
 
 lab var claimdummy "Credit Claims (Dummy)"
 lab var claimed_per "Claim Rate"
 lab var claimed_log "(Annual Claims (ln))"



*Table 4 of the appendix

 *Replicates Table 4 of the appendix--main models, hazard ratios
stcox claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nolog cluster(gid_cow)
 
  outreg2 using DraftTable2v3, replace word excel label ctitle (Hazard Ratio for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per claimed_log claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) eform
 
stcox claimed_log peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302,  nolog cluster(gid_cow)

  outreg2 using DraftTable2v3, append word excel label ctitle (Hazard Ratio for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per claimed_log claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) eform
 
stcox claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302,  nolog cluster(gid_cow)

  outreg2 using DraftTable2v3, append word excel label ctitle (Hazard Ratio for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (  claimed_per claimed_log claimdummy peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) eform




*table 5 of the appendix, rerun baseline models but including ISIS
stset duration, failure(end)

stcox claimed_per multi_base_aps compclaims peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal  individual unknownlog if  foundedafter==1 & year >1997, nohr nolog cluster(gid_cow)
outreg2 using DraftTable4v2, replace word excel label ctitle (Cox Coefficients) addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (claimed_per peak_size multi_base_aps compclaims left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal individual unknownlog)
 
 stcox claimed_per multi_base_aps compclaims peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997,  nolog cluster(gid_cow)
outreg2 using DraftTable4v2, append word excel label ctitle (hazard ratio) addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (claimed_per  peak_size multi_base_aps compclaims left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal individual unknownlog) eform

*table 6 of the appendix-control for multiple bases multi_base_aps

stset, clear
stset duration, failure(end)

stcox claimed_per multi_base_aps peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)
 outreg2 using DraftTableRR5, replace word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal multi_base_aps individual unknownlog)

stcox claimed_per multi_base_aps peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq ucdp_internal individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nolog cluster(gid_cow)
outreg2 using DraftTableRR5, append word excel label ctitle (Hazard Ratio for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal multi_base_aps individual unknownlog) eform
 
 
 *This is the table 7 in the appendix, comparative risk models
 
 stset, clear
stset duration, failure(endstr==1)
 
stcrreg claimed_per compclaims log_competitor logattacksciv peak_size left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,3,4,5)
outreg2 using DraftTable7, replace word excel label ctitle (Military or Police) ///
 sortvar (claimed_per compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog) 


*splinter
		stset, clear
stset duration, failure(endstr==2)
 
stcrreg claimed_per compclaims log_competitor logattacksciv peak_size  left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==1,3,4,5)
outreg2 using DraftTable7, append word excel label ctitle (Splinter) ///
 sortvar (claimed_per compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog)

*Political Process
		stset, clear
stset duration, failure(endstr==3)
 
stcrreg claimed_per compclaims log_competitor logattacksciv peak_size  left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,1,4,5)
outreg2 using DraftTable7, append word excel label ctitle (Political Process) ///
 sortvar (claimed_per compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog )
 
 
*merger

		stset, clear
stset duration, failure(endstr==4)
 
stcrreg claimed_per compclaims log_competitor logattacksciv peak_size  left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,1,3,5)
outreg2 using DraftTable7, append word excel label ctitle (Mergers) ///
 sortvar (claimed_per compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog)


*inactivity

		stset, clear
stset duration, failure(endstr==5)
 
stcrreg claimed_per compclaims log_competitor logattacksciv peak_size left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log  diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,1,3,4)
outreg2 using DraftTable7, append word excel label ctitle (Inactivity) ///
 sortvar (claimed_per compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog)
 
 
 
 

*table 8  appendix, full time span to assess controls
*Full time span, 1970 to 2016

stset, clear

stset duration, failure(end)
 
stcox multi_base_aps peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol log_pop polity2 polity_sq ucdp_internal log_gdp_percap state_sponsor individual unknownlog, nohr nolog cluster(gid_cow)



 lab var peak_size "Group Peak Size"
 lab var left "Leftist Ideology"
 lab var right "Right-wing Ideology"
 lab var nat "Nationalist Ideology"
 lab var logattacksciv "Attacks on Civilians (logged)"
 lab var diversity "Attack Diversity"
 lab var shr_trans "Share Transnational"
 lab var lack_stterrcontrol "Lack Territorial Control"
 
 
 lab var log_pop "Base Country Population (logged)"
 lab var polity2 "Base Country Polity IV"
 lab var polity_sq "Polity score squared"
 lab var log_gdp_percap "GDP pc (logged)"
 lab var ucdp_internal "UCDP internal conflict in Base"

 lab var multi_base_aps "Multiple Bases"
 lab var shr_trans "Share Transnational"
 lab var diversity "Attack Diversity"

  outreg2 using DraftTablea8, replace word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) 
 
 
stcox multi_base_aps peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol log_pop polity2 polity_sq ucdp_internal log_gdp_percap state_sponsor individual unknownlog, nolog cluster(gid_cow)


  outreg2 using DraftTablea8, append word excel label ctitle (Hazard Ratio for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( peak_size left nat  right logattacksciv log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) eform
 
 *Table 9 in new appendix 
 
 stset, clear

stset duration, failure(end)

stcox claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq total_attacksgtd_log  ucdp_internal terrctrl state_sponsor individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)

 outreg2 using DraftTable9, replace word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per peak_size left nat  right logattacksciv total_attacksgtd_log  log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal terrctrl  state_sponsor individual unknownlog) 
 
 
stcox claimed_per peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq total_attacksgtd_log  ucdp_internal terrctrl  state_sponsor individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302,  nolog cluster(gid_cow)
 outreg2 using DraftTable9, append word excel label ctitle (Hazard Rate for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar (claimed_per peak_size  left nat  right logattacksciv total_attacksgtd_log  log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal terrctrl  state_sponsor individual unknownlog) eform
 
 *without these two edtg vars
 stcox claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq total_attacksgtd_log  ucdp_internal  individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)

 outreg2 using DraftTable9, append word excel label ctitle (Cox Coefficients for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per peak_size left nat  right logattacksciv total_attacksgtd_log  log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) 
 
 
 stcox claimed_per peak_size left nat  right logattacksciv log_competitor  diversity shr_trans   log_pop polity2 polity_sq total_attacksgtd_log  ucdp_internal  individual unknownlog if  foundedafter==1 & year >1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow)

 outreg2 using DraftTable9, append word excel label ctitle (Hazard Ratios for Group Demise)  addstat(N_clust, e(N_clust), Wald Chi2, e(chi2), Prob > Chi2, e(p)) ///
 sortvar ( claimed_per peak_size left nat  right logattacksciv total_attacksgtd_log  log_competitor  diversity shr_trans lack_stterrcontrol state_sponsor   log_pop polity2 polity_sq ucdp_internal individual unknownlog) eform
 
 


*table 10 

	stset, clear
stset duration, failure(endstr==1)
 
stcrreg claimed_log compclaims log_competitor logattacksciv peak_size left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,3,4,5)
outreg2 using DraftTable10, replace word excel label ctitle (Military or Police) ///
 sortvar (claimed_log compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog) 


*splinter
		stset, clear
stset duration, failure(endstr==2)
 
stcrreg claimed_log compclaims log_competitor logattacksciv peak_size  left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==1,3,4,5)
outreg2 using DraftTable10, append word excel label ctitle (Splinter) ///
 sortvar (claimed_log compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog)

*Political Process
		stset, clear
stset duration, failure(endstr==3)
 
stcrreg claimed_log compclaims log_competitor logattacksciv peak_size  left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,1,4,5)
outreg2 using DraftTable10, append word excel label ctitle (Political Process) ///
 sortvar (claimed_log compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog )
 
 
*merger

		stset, clear
stset duration, failure(endstr==4)
 
stcrreg claimed_log compclaims log_competitor logattacksciv peak_size  left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,1,3,5)
outreg2 using DraftTable10, append word excel label ctitle (Mergers) ///
 sortvar (claimed_log compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog)


*inactivity

		stset, clear
stset duration, failure(endstr==5)
 
stcrreg claimed_log compclaims log_competitor logattacksciv peak_size left nat  right log_gdp_percap log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log  diversity individual unknownlog if year > 1997 & gid!=669 & gid!=302, nohr nolog cluster(gid_cow) compete(endstr==2,1,3,4)
outreg2 using DraftTable10, append word excel label ctitle (Inactivity) ///
 sortvar (claimed_log compclaims peak_size  left nat  right logattacksciv log_competitor  diversity shr_trans log_pop polity2 polity_sq ucdp_internal  lack_stterrcontrol state_sponsor total_attacksgtd_log individual unknownlog)
 
 
 